﻿namespace WgFrame.Net
{
    using System;
    using System.Collections.Generic;
    using System.Reflection;

    public class OperationResponse
    {
        public short OperationCode;
        public short ReturnCode;
        public string DebugMessage;
        public Dictionary<byte, object> Parameters;

        public override string ToString() => 
            $"OperationResponse {OperationCode}: ReturnCode: {ReturnCode}.";

        public string ToStringFull() => 
            string.Format("OperationResponse {0}: ReturnCode: {1} ({3}). Parameters: {2}", new object[] { OperationCode, ReturnCode, SupportClass.DictionaryToString(Parameters), DebugMessage });

        public object this[byte parameterCode]
        {
            get
            {
                object obj2;
                Parameters.TryGetValue(parameterCode, out obj2);
                return obj2;
            }
            set
            {
                Parameters[parameterCode] = value;
            } 
        }
    }
}

